package cool.tenyears.admin.controller;

import cool.tenyears.admin.domain.LoginUserDto;
import cool.tenyears.admin.service.AdminUserService;
import cool.tenyears.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LiChuan
 * @date 2021/7/8 13:16
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/user")
public class AdminUserController {
    private final AdminUserService adminUserService;

    @PostMapping("/login")
    public R<LoginUserDto> login(@Validated @RequestBody LoginUserDto user) {
        adminUserService.login(user);
        return R.ok();
    }
}
